/**
 * Copyright © 2019 eqxiu.com 北京中网易企秀科技有限公司  All rights reserved.
 */
package com.siping.并发.黑马并发实战.自定义线程池;

import java.util.concurrent.TimeUnit;

/**
 * @author YangXu
 * @date 2022/2/20
 * @description:
 */
public class TestThreadPool {

    public static void main(String[] args) {
        ThreadPool threadPool = new ThreadPool(2, 3000, TimeUnit.MILLISECONDS, 10, (blockingQueue, task) -> {
            blockingQueue.put(task);
        });
        for (int i = 0; i < 15; i++) {
            int j = i;
            threadPool.execute(() -> {
                try {
                    Thread.sleep(100000L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(j);
            });
        }
    }
}
